Particles are not moving correctly [closed]

Posted by cr33p on Game Development See other posts from Game Development or by cr33p
Published on 2011-09-01T18:06:20Z Indexed on 2011/12/01 2:23 UTC
Read the original article Hit count: 202

Filed under:
|

I want to make a particle explosion, after something gets destroyed, but somehow only one line of mixed colors show up on the screen.

Here's the header:
http://pastebin.com/JW5bPLj2
Here's the source:
http://pastebin.com/KHmFqytD

I don't get what's wrong, as it's nearly the same as in "Programming Linux Games"

Can somebody help me fix that?

PS: "Uint32 delta" is needed to update the pixels based on time. PSS: Maybe I should add that it's programmed in C and includes SDL.

EDIT: Found the problem. It was the "drawParticles" function.
The problem was, that I passed a double to "offset" (as particles[i].x, etc are all doubles). So I ended up with values like ~MAX_INT because I didn't cast the doubles properly to ints.

© Game Development or respective owner

Related posts about programming

Related posts about math